/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import bean.Bancos;

/**
 *
 * @author Daniel Rodrigues
 */
public abstract class FactoryDatabase {

    public static FactoryDAO createFactory() {
        return createFactory(Bancos.JPA);
    }

    private static FactoryDAO createFactory(Bancos nomeBanco) {
        return getInstanceOfFactory(nomeBanco);
    }

    private static FactoryDAO getInstanceOfFactory(Bancos nomeBanco) {
        switch (nomeBanco) {
            case JPA:
                return new JPAFactoryDAO();
            case POSTGRES:
                return new POSTGRESFactoryDAO();
            case MYSQL:
                break;
            default:
                System.err.println("Banco não selecionado");
                throw new IllegalArgumentException("ServletConfig must not be null.");
        }
        return null;
    }
}
